<?php
/**
 * Created by PhpStorm.
 * User: dung
 * Date: 11/11/14
 * Time: 10:47 AM
 */

class Answer extends Eloquent
{
    use SoftDeletingTrait;

    protected $dates = ['deleted_at'];

    public function user()
    {
        return $this->belongsTo('User');
    }

    public function votes()
    {
        return $this->belongsToMany('User', 'votes', 'answer_id', 'user_id');
    }
public function addlike(){
    $this->votes = $this->votes +1;
    $this->save();
}
} 